//! A=A-B*D^-1*C; A(F*N_SEC_VARS); B(F*N_SEC_VARS); C(N_SEC_VARS), D(N_SEC_VARS)
//! D is diagonal
#define M_MINUS_VV_PROD2(N_SEC_VARS,F,A,B,C,D)               \
	for(int i = 0; i < (F); i++)                             \
	{                            \
		int sum = 0;                                          \
		int shift = (i / (N_SEC_VARS)) * (N_SEC_VARS);        \
		for(int j = 0; j < N_SEC_VARS; j++)                   \
        {                  \
			sum += (B)[shift + j] * (C)[j] / (D)[j];          \
		}                                                     \
		(A)[i] -= sum;                                        \
	} 

//! A=A-B*D^(-1)*C A (F*F); B(F*N_SEC_VARS); C(N_SEC_VARS*n); D(N_SEC_VARS)
//! D is diagonal
#define M_MINUS_MMM_PROD(N_SEC_VARS,F,A,B,C,D)                  \
	for (int i = 0; i < (F) * (F); i++)                            \
	{                                \
		int sum = 0;                                              \
		int shift_C = i % (F);                                    \
		int shift_B = i / (F) * (N_SEC_VARS);                      \
		for(int j = 0; j < (N_SEC_VARS); j++)                     \
		{                         \
			sum += (B)[shift_B + j] * (C)[shift_C + j * (F)] / (D)[j];        \
		}                                                        \
		(A)[i] -= sum;                                            \
	} 